//
//  CYCreditNewLitmitVC.m
//  CreditAddressBook
//
//  Created by Mosu&Cuu on 16/5/20.
//  Copyright © 2016年 Lee. All rights reserved.
//

#import "CYCreditNewLitmitVC.h"
#import "CYURL.h"
#import "CYLoginHttpTool.h"
#import "CYUser.h"
#import "UIImageView+WebCache.h"
#import "CYButtonView.h"
#import "SDHomeGridView.h"
#import "TOWebViewController.h"
#import "CYPayViewController.h"
#import "CYJumpsTool.h"
#import "CYPersonReleaseVC.h"
#import "CYMyDefaultRecordsVController.h"
#import "CYCreditBankVC.h"
#import "CYJsonInfo.h"
#import "NSObject+MJKeyValue.h"
#import "CYNavigationVController.h"
#import "UIAlertView+Block.h"
#import "CYCreditDetailWebVC.h"
#import "CYNormalSubmitVC.h"
#import "CYNormaladdVC.h"
#import "CYHeightAttestationVC.h"
#import "CYPersonAttestationVC.h"
#import "UIAlertView+Block.h"
#import "CYDES3Util.h"
#import <Foundation/Foundation.h>
#import <CoreText/CoreText.h>
#import <UIKit/UIKit.h>
#import "CYNewHeightVC.h"
#import "MBProgressHUD+LE.h"
#import "LEBarButtonItem.h"
#import "UIInfomationView.h"
#import "CustomIOSAlertView.h"
#import "MWPhotoBrowser.h"
#import "LEPhotoBrowserTool.h"
#import "CYLeveIVC.h"
#import "CYLevelRuleVC.h"
#import "CYHelpmanageVC.h"
#import "CYHeightH5WebVC.h"



@interface CYCreditNewLitmitVC ()
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@property (weak, nonatomic) IBOutlet UILabel *nicknameLab;
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *phoneLab;
@property (weak, nonatomic) IBOutlet UILabel *creditLevelLab;

@property (weak, nonatomic) IBOutlet UILabel *normalstatueLab;
@property (weak, nonatomic) IBOutlet UIImageView *normalstatuImageView;
@property (weak, nonatomic) IBOutlet UILabel *provelstatueLab;
@property (weak, nonatomic) IBOutlet UIImageView *provelstatuImageView;
@property (weak, nonatomic) IBOutlet UILabel *assetstatueLab;
@property (weak, nonatomic) IBOutlet UIImageView *assetstatuImageView;
@property (weak, nonatomic) IBOutlet UILabel *workstatueLab;
@property (weak, nonatomic) IBOutlet UIImageView *workstatuImageView;
@property (weak, nonatomic) IBOutlet UILabel *socialstatueLab;
@property (weak, nonatomic) IBOutlet UIImageView *socialstatuImageView;

@property (nonatomic, strong)NSDictionary *genealdata;
@property (nonatomic, strong)NSDictionary *provedata;
@property (nonatomic, strong)NSDictionary *assetdata;
@property (nonatomic, strong)NSDictionary *workdata;
@property (nonatomic, strong)NSDictionary *socialdata;
@property (nonatomic, strong)NSString *examineStatus;
@property (nonatomic, strong)NSString *proveStatus;
@property (nonatomic, strong)NSString *assetStatus;
@property (nonatomic, strong)NSString *workStatus;
@property (nonatomic, strong)NSString *socialStatus;
@property (nonatomic, strong)NSString *level;
@property (nonatomic, strong)NSString *account;
@property (nonatomic, strong)NSString *exmaintime;
@property (nonatomic, strong) NSDictionary *dic;
@property (nonatomic, strong) NSString *str;
@property (nonatomic, strong) NSMutableArray *arr;
@property (nonatomic, strong) NSString *reason;
@property (nonatomic, strong)UIImageView *contentLineImageView;

@property (nonatomic, strong) NSString *proGostatues;
@property (nonatomic, strong) NSString *assGostatues;
@property (nonatomic, strong) NSString *wokGostatues;

@property (nonatomic, strong) UITextField *dealcodeTF;

@property (nonatomic, strong) NSString *heightstr;
@property (nonatomic, strong) NSString *zmfstr;

@property (weak, nonatomic) IBOutlet UILabel *fangpianLab;
@property (weak, nonatomic) IBOutlet UILabel *wenxinLab;
@property (weak, nonatomic) IBOutlet UILabel *dinahuaLab;

@property (weak, nonatomic) IBOutlet UIView *cardbackView;

@property (weak, nonatomic) IBOutlet UILabel *levelLab;
@property (weak, nonatomic) IBOutlet UILabel *creditaccountLab;
@property (weak, nonatomic) IBOutlet UILabel *useaccountLab;
@property (weak, nonatomic) IBOutlet UILabel *nametimeLab;

@property(nonatomic,strong)UIView *bg;
@property(nonatomic,strong)UIView *weixinbg;
@property (nonatomic, strong) UIView *weixinView;




@end

@implementation CYCreditNewLitmitVC



- (void)viewWillAppear:(BOOL)animated{
     
     _cardbackView.layer.cornerRadius = 10.0f;
     //self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
     NSString *fangpianstr = @"防骗提示：平台工作人员不会以任何方式向您索取资金或账户信息，“充值”功能为平台唯一资金渠道，谨防受骗。如有疑问请加官方微信“天下无赖诚信联盟”咨询。";
     NSMutableAttributedString *fangpianattrStr = [[NSMutableAttributedString alloc] initWithString:fangpianstr];
     [fangpianattrStr addAttribute:NSForegroundColorAttributeName
                     value:[UIColor redColor]
                     range:NSMakeRange(0, 5)];
     _fangpianLab.attributedText = fangpianattrStr;
     
     NSString *wenxinstr = @"温馨提示：故意提交虚假资料，将永久拒贷";
     NSMutableAttributedString *wenxinattrStr = [[NSMutableAttributedString alloc]initWithString:wenxinstr];
     [wenxinattrStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 5)];
     _wenxinLab.attributedText = wenxinattrStr;
     
     NSString *phonestr = @"注:客服将在24小时内进行审核，请注意接听来自云南的审核电话";
     NSMutableAttributedString *phoneattrStr = [[NSMutableAttributedString alloc]initWithString:phonestr];
     [phoneattrStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(23, 2)];
     _dinahuaLab.attributedText = phoneattrStr;

     
//     NSString *dianhuastr = @"注:客服将在24小时内进行审核，请注意接听来自云南的审核电话";
//     NSMutableAttributedString *dianhuaattrStr = [[NSMutableAttributedString alloc]initWithString:dianhuastr];
//     [dianhuaattrStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(23, 25)];
//     _dinahuaLab.attributedText = dianhuaattrStr;
     
      _contentLineImageView.hidden = YES;
     [super viewWillAppear:animated];
     
     
     
}

-(void)loadheightstatues{
     
     CYUser *user = [CYLoginHttpTool userData].user;
     [MBProgressHUD showMessage:@"加载中..." toView:self.view];
     [CYHttpTool postWithURL:[CYURL shared].getJuHeStatus params:@{@"userId":user.userId,@"token":user.token} success:^(id json) {
          CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
          [MBProgressHUD hideHUDForView:self.view animated:YES];
          CYLog(@"jsoninfo = %@",jsoninfo.data);
          NSArray *dataArr = jsoninfo.data;
          if (jsoninfo.isSuccess) {
               //
               for (NSDictionary *dic in dataArr) {
                    NSString *statues = [dic objectForKey:@"status"];
                    if (statues.intValue == 1) {
                         _provelstatueLab.text = @"可更新";
                         
                    }
                    
               }
               
          }
          
     } failure:^(NSError *error) {
          [MBProgressHUD hideHUDForView:self.view animated:YES];
     }];
     
}

- (UIImageView *)findHairlineImageViewUnder:(UIView *)view {
     if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
          return (UIImageView *)view;
     }
     for (UIView *subview in view.subviews) {
          UIImageView *imageView = [self findHairlineImageViewUnder:subview];
          if (imageView) {
               return imageView;
          }
     }
     return nil;
}
- (void)viewWillDisappear:(BOOL)animated {
     [super viewWillDisappear:animated];
     _contentLineImageView.hidden = NO;
}
- (void)setupsouces{
     CYUser *user = [CYLoginHttpTool userData].user;
     _headerImageView.layer.cornerRadius = _headerImageView.width/2;
     _headerImageView.clipsToBounds = YES;
     _headerImageView.backgroundColor = [UIColor grayColor];
     if (user.headPic) {
          [_headerImageView sd_setImageWithURL:CYURLWithUserService(user.headPic) placeholderImage:nil];
     }else if (!user.headPic) {
          _headerImageView.image = [UIImage imageNamed:@"complete_profile_men_sel"];
          
     }
     
      LEBarButtonItem *help = [[LEBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_bz"] andSelImage:nil andTitle:@"帮助" target:self action:@selector(helpclick)];
     self.navigationItem.rightBarButtonItem = help;
     
     //昵称
     if (user.name) {
          // 将中文字符串转成可变字符串
          NSMutableString *pinyinText = [[NSMutableString alloc] initWithString:user.name];
          
          // 先转换为带声调的拼音
          CFStringTransform((__bridge CFMutableStringRef)pinyinText, 0, kCFStringTransformMandarinLatin, NO);
          NSLog(@"pinyin: %@", pinyinText); // 输出 pinyin: zhōng guó sì chuān
          // 再转换为不带声调的拼音
          CFStringTransform((__bridge CFMutableStringRef)pinyinText, 0, kCFStringTransformStripDiacritics, NO);
          NSLog(@"pinyin: %@", pinyinText); // 输出 pinyin: zhong guo si chuan
          // 转换为首字母大写拼音
          NSString *capitalPinyin = [pinyinText capitalizedString];
          NSLog(@"capitalPinyin: %@", capitalPinyin); // 输出 capitalPinyin: Zhong Guo Si Chuan
          _nametimeLab.text = capitalPinyin;
          
     }else{
          _nicknameLab.text = @"--";
     }
     //名字
     _nameLab.text = [NSString stringWithFormat:@"*%@",[user.name substringFromIndex:1]];
     
     //电话号码
     _phoneLab.text  = user.phone;
     _phoneLab.text = user.phone;
     
}
-(void)helpclick{
     CYHelpmanageVC *help = [[CYHelpmanageVC alloc]init];
     [self.navigationController pushViewController:help animated:YES];
     
}
/**
 *  图片浏览器
 */
- (void)photoBrowser:(UITapGestureRecognizer *)tag {
     
     NSString *str = @"http://www.credit-manage.com:8058/apppic/prove/shenghuozhao1.jpg";
     NSArray *urls = @[str];
     MWPhoto *photo = nil;
     NSMutableArray *photos = [NSMutableArray array];
     for (NSString *url in urls) {
          photo = [MWPhoto photoWithURL:CYURLWithService(url)];
          //        photo.caption = @"title";
          [photos addObject:photo];
     }
     [LEPhotoBrowserTool showPhotoBrowserWithController:self photos:photos];

}




- (void)viewDidLoad {
     [super viewDidLoad];
     
     [self setupsouces];
     [self loadstatus];
     [self loadheightstatues];
     [self updatelevel];
     [self setupNoti];
     _dic = [[NSDictionary alloc]init];
     _arr = [[NSMutableArray alloc]init];
     _contentLineImageView = [self findHairlineImageViewUnder:self.navigationController.navigationBar];
     self.navigationController.navigationBar.barTintColor = CYColor(82, 204, 82, 1);
     //这句话 要写上。 默认是YES可能你得到的颜色与实际的不匹配。  默认为YES 说明是有透明度的。
     self.navigationController.navigationBar.translucent = YES;
     [self setupNavigationView];
    // Do any additional setup after loading the view from its nib.
}

- (void)setupNavigationView {
     
     UIView *naviView = [[UIView alloc] init];
     naviView.backgroundColor = CYNaviThemeColor;
     naviView.frame = CGRectMake(0, 0, self.view.width, 64);
     [self.view addSubview:naviView];
}

-(void)updatelevel{
     CYUser *user = [CYLoginHttpTool userData].user;
     [CYHttpTool postWithURL:[CYURL shared].getCreditLevel params:@{@"userId":user.userId,@"token":user.token} success:^(id json) {
          CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
          NSDictionary *data = jsoninfo.data;
          if (data) {
               _level = [data objectForKey:@"tlevel"];
               if ([_level isEqualToString:@"1"]||[_level isEqualToString:@"2"]) {
                    _levelLab.text = [NSString stringWithFormat:@"实习卡LV%@>>",_level];
               }if ([_level isEqualToString:@"3"]||[_level isEqualToString:@"4"]) {
                    _levelLab.text = [NSString stringWithFormat:@"普通卡LV%@>>",_level];
               }if ([_level isEqualToString:@"5"]||[_level isEqualToString:@"6"]) {
                    _levelLab.text = [NSString stringWithFormat:@"白金卡LV%@>>",_level];
               }if ([_level isEqualToString:@"7"]||[_level isEqualToString:@"8"]) {
                    _levelLab.text = [NSString stringWithFormat:@"钻石卡LV%@>>",_level];
               }if ([_level isEqualToString:@"9"]||[_level isEqualToString:@"10"]) {
                    _levelLab.text = [NSString stringWithFormat:@"黑卡LV%@>>",_level];

               }
               _account = [data objectForKey:@"creditAccount"];
               _creditaccountLab.text = [NSString stringWithFormat:@"信用身价：%@元",_account];
               _useaccountLab.text = [NSString stringWithFormat:@"可用身价：%@元",data[@"useAccount"]];
     
               // _xinyongshenjiaLab.text = @"可用余额:999999999999999999";
          }
          
     } failure:^(NSError *error) {
          
     }];
}

- (IBAction)levelClick:(id)sender {
     
//     CYLeveIVC *rule = [[CYLeveIVC alloc]init];
//     [self.navigationController pushViewController:rule animated:YES];
     
     
     if ([_level isEqualToString:@"1"]) {
//          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"满足以下条件可成功升级LV2！\n1.信用身价>=3000元；\n2.用户当前所有借款都已经结清；\n3.三个月内无超过10天以上的逾期记录；\n4.通过“增值服务”-- “购买升级卡”，完成升级。" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//          [alert show];
          
          UIView *bgView = [[UIView alloc] initWithFrame:self.view.frame];
          bgView.layer.cornerRadius = 5.0f;
          bgView.backgroundColor = [UIColor grayColor];
          bgView.alpha = 0.8;
          self.weixinbg = bgView;
          self.weixinbg.hidden = NO;
          [[UIApplication sharedApplication].keyWindow addSubview:_weixinbg];
          //     _shituview =[[UIView alloc]initWithFrame: CGRectMake(30,120,self.view.frame.size.width-60,400)];
          _weixinView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.size.width-60, 200)];
          _weixinView.center = self.view.center;
          _weixinView.backgroundColor = [UIColor whiteColor];
          [[UIApplication sharedApplication].keyWindow addSubview:_weixinView];
          [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_weixinView];
          
          UILabel *titlelab = [[UILabel alloc]initWithFrame:CGRectMake(0, 20,self.weixinView.width , 30)];
          titlelab.text = @"LV1升至LV2条件";
          titlelab.textAlignment = NSTextAlignmentCenter;
          [self.weixinView addSubview:titlelab];
          
          UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(3, titlelab.y+titlelab.height+1, _weixinView.width-6, 1)];
          lineView.backgroundColor = [UIColor groupTableViewBackgroundColor];
          [self.weixinView addSubview:lineView];
          
          UILabel *detailLab = [[UILabel alloc]initWithFrame:CGRectMake(3, lineView.height+lineView.y+1, lineView.width, 100)];
//          detailLab.backgroundColor = [UIColor orangeColor];
          detailLab.numberOfLines = 5;
          detailLab.text = @"1.信用身价>=3000元；\n2.用户当前所有借款都已经结清；\n3.三个月内无超过10天以上的逾期记录；\n4.通过“增值服务”-- “购买升级卡”，完成升级。";
          detailLab.font = [UIFont systemFontOfSize:13.0f];
          [_weixinView addSubview:detailLab];
          
          
          UIView *lastLine = [[UIView alloc]initWithFrame:CGRectMake(3, detailLab.y+detailLab.height+2, _weixinView.width-6, 1)];
          lastLine.backgroundColor = [UIColor groupTableViewBackgroundColor];
          [_weixinView addSubview:lastLine];
          
          UIButton *cancalBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, detailLab.y+detailLab.height+8, _weixinView.width, 30)];
//          cancalBtn.backgroundColor = [UIColor orangeColor];
          [cancalBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
          [cancalBtn setTitle:@"取消" forState:UIControlStateNormal];
          [cancalBtn addTarget:self action:@selector(viewbeclose) forControlEvents:UIControlEventTouchUpInside];
          [_weixinView addSubview:cancalBtn];
          
          
          
     }else if ([_level isEqualToString:@"2"]){
//          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"满足以下条件可成功升级LV3！  \n1.信用身价>=6000元；\n2.尽可能完成更多的高级认证；\n3.保持良好信用记录，减少3天以上的逾期记录；\n4.多产生借款记录。" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//          [alert show];

          UIView *bgView = [[UIView alloc] initWithFrame:self.view.frame];
          bgView.backgroundColor = [UIColor grayColor];
          bgView.alpha = 0.8;
          self.weixinbg = bgView;
          self.weixinbg.hidden = NO;
          [[UIApplication sharedApplication].keyWindow addSubview:_weixinbg];
          //     _shituview =[[UIView alloc]initWithFrame: CGRectMake(30,120,self.view.frame.size.width-60,400)];
          _weixinView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.size.width-60, 200)];
          _weixinView.layer.cornerRadius = 15.0f;
          _weixinView.layer.borderWidth = 1.0f;
          _weixinView.center = self.view.center;
          _weixinView.backgroundColor = [UIColor whiteColor];
          [[UIApplication sharedApplication].keyWindow addSubview:_weixinView];
          [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_weixinView];
          
          UILabel *titlelab = [[UILabel alloc]initWithFrame:CGRectMake(0, 20,self.weixinView.width , 30)];
          titlelab.text = @"LV2升至LV3条件";
          titlelab.textAlignment = NSTextAlignmentCenter;
          [self.weixinView addSubview:titlelab];
          
          UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(3, titlelab.y+titlelab.height+1, _weixinView.width-6, 1)];
          lineView.backgroundColor = [UIColor groupTableViewBackgroundColor];
          [self.weixinView addSubview:lineView];
          
          UILabel *detailLab = [[UILabel alloc]initWithFrame:CGRectMake(3, lineView.height+lineView.y+1, lineView.width, 100)];
          //          detailLab.backgroundColor = [UIColor orangeColor];
          detailLab.numberOfLines = 5;
          detailLab.text = @"1.信用身价>=6000元；\n2.尽可能完成更多的高级认证；\n3.保持良好信用记录，减少3天以上的逾期记录；\n4.多产生借款记录。";
          detailLab.font = [UIFont systemFontOfSize:13.0f];
          [_weixinView addSubview:detailLab];
          
          
          UIView *lastLine = [[UIView alloc]initWithFrame:CGRectMake(3, detailLab.y+detailLab.height+2, _weixinView.width-6, 1)];
          lastLine.backgroundColor = [UIColor groupTableViewBackgroundColor];
          [_weixinView addSubview:lastLine];
          
          UIButton *cancalBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, detailLab.y+detailLab.height+8, _weixinView.width, 30)];
          //          cancalBtn.backgroundColor = [UIColor orangeColor];
          [cancalBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
          [cancalBtn setTitle:@"取消" forState:UIControlStateNormal];
          [cancalBtn addTarget:self action:@selector(viewbeclose) forControlEvents:UIControlEventTouchUpInside];
          [_weixinView addSubview:cancalBtn];
          
     }
     
}
-(void)viewbeclose{
     
     _weixinbg.hidden = YES;
     _weixinView.hidden = YES;
     
     
}



-(void)loadstatus{
     CYUser *user = [CYLoginHttpTool userData].user;
     if (user) {
          NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];//获取version
          NSString *versionstr = [NSString stringWithFormat:@"ios%@",appVersion];
          //必填类状态:
          [CYHttpTool postWithURL:[CYURL shared].getGeneralInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
               CYJsonInfo *genealjsonInfo = [CYJsonInfo objectWithKeyValues:json];
               if (genealjsonInfo.isSuccess) {
                    _genealdata = genealjsonInfo.data;//1初审 3终审 2审核通过 －1不通过
                    
                    _examineStatus = [_genealdata objectForKey:@"examineStatus"];
                    
                    //                CYLog(@"examinestatus = %@",_examineStatus);
                    _exmaintime = [_genealdata objectForKey:@"examineDate"];
                    _reason = [_genealdata objectForKey:@"examineReason"];
                if (_examineStatus&&_examineStatus.intValue == 0 ) {
                              _normalstatueLab.text = @"身价评估中";
                    [_normalstatuImageView setImage:[UIImage imageNamed:@"灯1.png"]];
                              
                         }

                    if (_examineStatus.intValue == 1) {
                         _normalstatueLab.text = @"初审中";
                         [_normalstatuImageView setImage:[UIImage imageNamed:@"灯1.png"]];
                    
                    }if (_examineStatus.intValue == -1) {
                         _normalstatueLab
                         .text = @"未通过";
                         [_normalstatuImageView setImage:[UIImage imageNamed:@"灯3.png"]];
                         _provelstatueLab.text = @"";
                         _assetstatueLab.text = @"";
                         _workstatueLab.text = @"";
                         _socialstatueLab.text = @"";
                         _provelstatuImageView.hidden = YES;
                         _workstatuImageView.hidden = YES;
                         _assetstatuImageView.hidden = YES;
                         
                         
                    }if (_examineStatus.intValue == -2) {
                         _normalstatueLab
                         .text = @"被拒贷";
                         [_normalstatuImageView setImage:[UIImage imageNamed:@"灯3.png"]];
                         _provelstatueLab.text = @"";
                         _assetstatueLab.text = @"";
                         _workstatueLab.text = @"";
                         _socialstatueLab.text = @"";
                         _provelstatuImageView.hidden = YES;
                         _workstatuImageView.hidden = YES;
                         _assetstatuImageView.hidden = YES;
                         return ;
                         
                    }if (_examineStatus.intValue == 2) {
                         _normalstatueLab.text = @"可更新";
                         _normalstatuImageView.image = [UIImage imageNamed:@"灯2.png"];
                    }if (_examineStatus.intValue == 3) {
                         _normalstatueLab.text = @"终审中";
                         [_normalstatuImageView setImage:[UIImage imageNamed:@"灯1.png"]];
                    }
               }
          } failure:^(NSError *error) {
               CYLog(@"error =%@",error);
               CYLog(@"nothing");
               
          }];
          //个人类状态
          [CYHttpTool postWithURL:[CYURL shared].getProveInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
               CYJsonInfo *provejsonInfo = [CYJsonInfo objectWithKeyValues:json];
               if (provejsonInfo.isSuccess) {
                    _provedata = provejsonInfo.data;
                    _proveStatus = (NSString *)[_provedata objectForKey:@"examineStatus"];
                    if (_proveStatus.intValue == 1 || _proveStatus.intValue == 3) {
                         _assetstatueLab.text = @"审核中";
                         _assetstatuImageView.image = [UIImage imageNamed:@"灯1.png"];
                         _proGostatues = @"fause";
                    }if (_proveStatus.intValue == 2 || !_provedata) {
                         _proGostatues = @"ture";
                    }
               }
          } failure:^(NSError *error) {
               CYLog(@"error =%@",error);
               CYLog(@"nothing");
               
          }];
          //资产类状态
          [CYHttpTool postWithURL:[CYURL shared].getAssetInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
               CYJsonInfo *assetjsonInfo = [CYJsonInfo objectWithKeyValues:json];
               if (assetjsonInfo.isSuccess) {
                    _assetdata = assetjsonInfo.data;
                    _assetStatus = (NSString *)[_assetdata objectForKey:@"examineStatus"];
                    if (_assetStatus.intValue== 1 || _assetStatus.intValue == 3) {
                         _assetstatueLab.text = @"审核中";
                         _assetstatuImageView.image = [UIImage imageNamed:@"灯1.png"];
                         _assGostatues = @"fause";
                    }if (_assetStatus.intValue == 2 || !_assetdata) {
                         _assGostatues = @"ture";
                    }
               }
               } failure:^(NSError *error) {
               CYLog(@"error =%@",error);
               CYLog(@"nothing");
               
          }];
          //工作类类状态
          [CYHttpTool postWithURL:[CYURL shared].getWorkInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
               CYJsonInfo *workjsonInfo = [CYJsonInfo objectWithKeyValues:json];
               if (workjsonInfo.isSuccess) {
                    _workdata = workjsonInfo.data;
                    _workStatus = (NSString *)[_workdata objectForKey:@"examineStatus"];
                    if (_workStatus.intValue == 1 || _workStatus.intValue == 3) {
                         _assetstatueLab.text = @"审核中";
                         _assetstatuImageView.image = [UIImage imageNamed:@"灯1.png"];
                         _wokGostatues = @"fause";
                    }if (_workStatus.intValue == 2 || !_workdata) {
                         _wokGostatues = @"ture";
                    }
               }
          } failure:^(NSError *error) {
               CYLog(@"error =%@",error);
               CYLog(@"nothing");
               
          }];
          
     }
}


//必填类
- (IBAction)NomorlClick:(id)sender {
     if (!_genealdata) {
          //new genealsubmitvc 更名：基本类资料提交
          CYNormalSubmitVC *normal = [[CYNormalSubmitVC alloc]init];
          [self.navigationController pushViewController:normal animated:YES];
          CYLog(@"怎么会没进去呢？============");
          
     }else if(_genealdata){
          if (_examineStatus.intValue == 0) {
               CYAlertView(@"您的资料待审核中，无法继续提交");
               CYLog(@"1111");
          }
          if (_examineStatus.intValue == 2) {
               CYNormalSubmitVC *addvc = [[CYNormalSubmitVC alloc]init];
               [self.navigationController pushViewController:addvc animated:YES];
          CYLog(@"2222");
               
          }if (_examineStatus.intValue == 1 || _examineStatus.intValue == 3) {
               CYAlertView(@"您的资料正在审核中!");
               CYLog(@"3333");
          }if (_examineStatus.intValue == -1) {
               UIAlertView *notice =[[UIAlertView alloc]initWithTitle:@"提示" message:@"您的资料审核未通过，是否重新提交？" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
               CYLog(@"4444");
               [notice show];
               [notice showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
                    if (buttonIndex == 1) {
                         CYNormalSubmitVC *normal = [[CYNormalSubmitVC alloc]init];
                         [self.navigationController pushViewController:normal animated:YES];
                         CYLog(@"6666");
                    }
               }];
          }
          if (_examineStatus.intValue == -2) {
                         CYNormalSubmitVC *normal = [[CYNormalSubmitVC alloc]init];
                         [self.navigationController pushViewController:normal animated:YES];
     CYLog(@"5555");
         }
     }
}

//高级认证
- (IBAction)ProvelClick:(id)sender {
     if (_examineStatus.intValue == 2) {
//          CYUser *user = [CYLoginHttpTool userData].user;
          [CYHttpTool postWithURL:[CYURL shared].getJuHeH5Status params:nil success:^(id json) {
               CYJsonInfo *jsoninfo = [ CYJsonInfo objectWithKeyValues:json];
               NSString *statue = jsoninfo.data;
               if (statue.intValue == 1) {
                    //进入webview
                   CYHeightH5WebVC *add= [[CYHeightH5WebVC alloc]init];
                    add.hidesBottomBarWhenPushed = YES;
                    [[self navigationController] setNavigationBarHidden:YES animated:YES];
                    [self.navigationController pushViewController:add animated:YES];
                    
               }else{
                    //原生
                    CYNewHeightVC *heiat = [[CYNewHeightVC alloc]init];
                    [self.navigationController pushViewController:heiat animated:YES];
               }
               
          } failure:^(NSError *error) {
               
          }];
          
     }else{
          CYAlertView(@"请先通过必填类");
          
     }

}

//人工认证
- (IBAction)AssetClick:(id)sender {
     
//     CYPersonAttestationVC *personall = [[CYPersonAttestationVC alloc]init];
//     [self.navigationController pushViewController:personall animated:YES];
     
     if ([_assGostatues isEqualToString:@"fause"] || [_wokGostatues isEqualToString:@"fause"] || [_proGostatues isEqualToString:@"fause"] ) {
          CYAlertView(@"您有正在审核的资料");
          return;
     }
     if (!_genealdata) {
          CYAlertView(@"请先认证必填类");
          return;
     }
     if (_examineStatus.intValue == -2) {
          CYAlertView(@"您已被拒贷");
          return;
     }
     if (_examineStatus.intValue == -1) {
          CYAlertView(@"必填类未通过");
          return;
          
     }
     if (_examineStatus.intValue == 1 || _examineStatus.intValue == 3) {
          CYAlertView(@"必填类审核中");
          return;
     }
     if (_examineStatus.intValue == 2) {
          CYPersonAttestationVC *personall = [[CYPersonAttestationVC alloc]init];
          [self.navigationController pushViewController:personall animated:YES];
          
     }
     
}

- (IBAction)creditdetailClick:(id)sender {
     
     CYCreditDetailWebVC *cvc = [[CYCreditDetailWebVC alloc]init];
     cvc.hidesBottomBarWhenPushed = YES;
     [[self navigationController] setNavigationBarHidden:YES animated:YES];
     [self.navigationController pushViewController:cvc animated:YES];

}


- (IBAction)SocialClick:(id)sender {
     
}

#pragma mark - 通知
- (void)setupNoti {
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(assetclick)name:CYAssetNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(personclick)name:CYPersonNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(workclick)name:CYWorkNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(otherclick)name:CYOhterNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(genealclick)name:CYGenealNotification object:nil];
     
}

-(void)assetclick{
     CYUser *user = [CYLoginHttpTool userData].user;
     NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];//获取version
     NSString *versionstr = [NSString stringWithFormat:@"ios%@",appVersion];
     //资产类状态
     [CYHttpTool postWithURL:[CYURL shared].getAssetInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
          CYJsonInfo *assetjsonInfo = [CYJsonInfo objectWithKeyValues:json];
          if (assetjsonInfo.isSuccess) {
               _assetdata = assetjsonInfo.data;
               _assetStatus = (NSString *)[_assetdata objectForKey:@"examineStatus"];
          }
     } failure:^(NSError *error) {
          CYLog(@"error =%@",error);
          CYLog(@"nothing");
          
     }];
     
}

-(void)personclick{
     CYUser *user = [CYLoginHttpTool userData].user;
     NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];//获取version
     NSString *versionstr = [NSString stringWithFormat:@"ios%@",appVersion];
     
     //个人类状态
     [CYHttpTool postWithURL:[CYURL shared].getProveInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
          CYJsonInfo *provejsonInfo = [CYJsonInfo objectWithKeyValues:json];
          if (provejsonInfo.isSuccess) {
               _provedata = provejsonInfo.data;
               _proveStatus = (NSString *)[_provedata objectForKey:@"examineStatus"];
          }
     } failure:^(NSError *error) {
          CYLog(@"error =%@",error);
          CYLog(@"nothing");
          
     }];
     
}
-(void)workclick{
     CYUser *user = [CYLoginHttpTool userData].user;
     NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];//获取version
     NSString *versionstr = [NSString stringWithFormat:@"ios%@",appVersion];
     
     //工作类类状态
     [CYHttpTool postWithURL:[CYURL shared].getWorkInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
          CYJsonInfo *workjsonInfo = [CYJsonInfo objectWithKeyValues:json];
          if (workjsonInfo.isSuccess) {
               _workdata = workjsonInfo.data;
               _workStatus = (NSString *)[_workdata objectForKey:@"examineStatus"];
          }
     } failure:^(NSError *error) {
          CYLog(@"error =%@",error);
          CYLog(@"nothing");
          
     }];
     
     
}
-(void)otherclick{
     CYUser *user = [CYLoginHttpTool userData].user;
     NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];//获取version
     NSString *versionstr = [NSString stringWithFormat:@"ios%@",appVersion];
     
     //其他类状态
     [CYHttpTool postWithURL:[CYURL shared].getSocialInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
          CYJsonInfo *socialjsonInfo = [CYJsonInfo objectWithKeyValues:json];
          if (socialjsonInfo.isSuccess) {
               _socialdata = socialjsonInfo.data;
               _socialStatus = (NSString *)[_socialdata objectForKey:@"examineStatus"];
          }
     } failure:^(NSError *error) {
          CYLog(@"error =%@",error);
          CYLog(@"nothing");
          
     }];
}
-(void)genealclick{
     CYUser *user = [CYLoginHttpTool userData].user;
     NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];//获取version
     NSString *versionstr = [NSString stringWithFormat:@"ios%@",appVersion];
     //必填类状态:
     [CYHttpTool postWithURL:[CYURL shared].getGeneralInfoStatus params:@{@"userId":user.userId,@"token":user.token,@"version":versionstr} success:^(id json) {
          CYJsonInfo *genealjsonInfo = [CYJsonInfo objectWithKeyValues:json];
          if (genealjsonInfo.isSuccess) {
               _genealdata = genealjsonInfo.data;
               _examineStatus = (NSString *)[_genealdata objectForKey:@"examineStatus"];
               _exmaintime = [_genealdata objectForKey:@"examineDate"];
          }
     } failure:^(NSError *error) {
          CYLog(@"error =%@",error);
          CYLog(@"nothing");
          
     }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
